﻿@using DotNetDream.Helper;
@model DotNetDream.Models.BlogEntry
@{
    ViewBag.Title = "DotNetDream - View Entry";
}
<h1>@Model.Title</h1>
<h3>
    On @Model.Created.ToString("dd/MMMM/yyyy HH:mm:ss") by @Html.ViewAccountLink(@Model.BlogUser.Id)</h3>
@using (Html.BeginForm())
{
    <div id="dnd-content-wrapper">
        @Html.HiddenFor(blogId => @Model.BlogId)
        <div class="entryBody">
            @Html.Raw(@Model.Content)
        </div>
        <h2>
            Other Comments</h2>
        @if (Model.BlogEntryComments.Count > 0)
        {
            foreach (var item in @Model.BlogEntryComments)
            {
            <div class="commentBody">
                <table width="100%" border="0">
                    <tr>
                        <td colspan="2" class="commentAuthor">
                            <div class="floatLeft">
                                @Html.ViewAccountLink(@item.OwnerId)
                            </div>
                            <div class="floatRight">
                                <h3>@item.Created.ToString("dd MMMM yyyy @ HH:mm")</h3>
                            </div>
                        </td>
                    </tr>
                    <tr valign="top">
                        <td class="commentAuthorAvatar">
                            @Html.Image(@item.OwnerAvatarUrl, "No Avatar", 100, 100)
                        </td>
                        <td class="commentContent">
                            @Html.Raw(item.Content)
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2" class="commentDate">
                            <h3>
                            </h3>
                        </td>
                    </tr>
                </table>
            </div>
            }
        }
        else
        {
            @:No comment found.
                                                                                                                                                }
        <h2>
            Your Comment</h2>
        <div style="margin-bottom: 20px">
            @Html.TextAreaFor(comment => @Model.NewComment)
        </div>
        <div id="dnd-command-bar">
            <input type="submit" name="command" value="Comment" class="dndSubmitButton" />
            <input type="submit" name="command" value="Back" class="dndSubmitButton" />
        </div>
        <script src="@Url.Content("~/Content/CKEditor/ckeditor.js")"  type="text/javascript")></script>
        <script src="@Url.Content("~/Content/CKEditor/adapters/jquery.js")"  type="text/javascript")></script>
    </div>
}
